<?php
/**
 * Created by gumaor.com
 * User: tommy
 */

namespace app\cli\controller;


use dekuan\dedid\CDId;
use lib\jwt\Token;
use Overtrue\Pinyin\Pinyin;
use service\user\UserService;
use Timo\Config\Config;
use Timo\Helper;

class Test extends Cli
{
    public function pinyin()
    {
        $pinyin = new Pinyin();

        $ret = $pinyin->convert('带着希望去旅行，比到达终点更美好');
        print_r($ret);
    }

    public function testDeDid()
    {
        $cDid = CDId::getInstance();

        $nCenter = 0;
        $nNode = 0;
        $arrData = [];

        $newId = $cDid->createId($nCenter, $nNode, 'abc', $arrData);

        echo $newId . PHP_EOL;
        print_r($arrData);
    }

    public function testToken()
    {
        //$token = Token::createToken(2);
        $token = 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImp0aSI6InczMGw0OEV2OXoyM0J6aTkxZ0IwIn0.eyJpc3MiOiJodHRwOlwvXC9hcGkudGltb3BocC5jb20iLCJhdWQiOiJodHRwOlwvXC9hcGkudGltb3BocC5jb20iLCJqdGkiOiJ3MzBsNDhFdjl6MjNCemk5MWdCMCIsImlhdCI6MTUzMjMzODAyOCwiZXhwIjoxNTMyNDI0NDI4LCJ1aWQiOjB9.EuGyejiODNkRmfh2dtL52D-W0-oITMVXoH7Hjqk_-Ew';
        $ret = Token::validateToken($token);
        var_dump($ret);
    }

    public function test()
    {
        echo Helper::random(20) . PHP_EOL;
    }
}
